package com.yida.gwj.report.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yida.common.core.annotation.Excel;
import com.yida.common.core.utils.StringUtils;
import com.yida.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.time.LocalDate;

/**
 * 系统结息对象 gwj_sys_calculate_rate
 * 
 * @author lqq
 * @date 2024-02-28
 */
public class GwjSysCalculateRate extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键ID */
    private Long id;

    /** 地区ID */
    @Excel(name = "地区ID")
    private Long areaId;

    /** 结算日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "结算日期", width = 30, dateFormat = "yyyy-MM-dd")
    private LocalDate calculateTime;

    /** 年增值收益（政府当次待分配利息） */
    @Excel(name = "年增值收益", readConverterExp = "政=府当次待分配利息")
    private BigDecimal yearBenefit;

    /** 状态 */
    @Excel(name = "状态")
    private String status;

    /** 年利率（个人日利率*365） */
    @Excel(name = "年利率", readConverterExp = "个=人日利率*365")
    private BigDecimal dayRate;

    /** 多地区查询 */
    private Long[] areaIds;
    
    /** 字符串年利率 */
    private String dayRateStr;

    public Long[] getAreaIds() {
        return areaIds;
    }

    public void setAreaIds(Long[] areaIds) {
        this.areaIds = areaIds;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setAreaId(Long areaId) 
    {
        this.areaId = areaId;
    }

    public Long getAreaId() 
    {
        return areaId;
    }
    public void setCalculateTime(LocalDate calculateTime)
    {
        this.calculateTime = calculateTime;
    }

    public LocalDate getCalculateTime()
    {
        return calculateTime;
    }
    public void setYearBenefit(BigDecimal yearBenefit) 
    {
        this.yearBenefit = yearBenefit;
    }

    public BigDecimal getYearBenefit() 
    {
        return yearBenefit;
    }
    public void setStatus(String status) 
    {
        this.status = status;
    }

    public String getStatus() 
    {
        return status;
    }
    public void setDayRate(BigDecimal dayRate) 
    {
//    	DecimalFormat df = new DecimalFormat("#.###########");
//    	this.dayRateStr = df.format(dayRate.doubleValue());
        this.dayRate = dayRate;
    }

    public BigDecimal getDayRate() 
    {
    	
        return dayRate;
    }

    public String getDayRateStr() {
    	if(!StringUtils.isNull(this.dayRate)) {
    		DecimalFormat df = new DecimalFormat("#.###########");
    		this.dayRateStr = df.format(dayRate.doubleValue());
    	}
		return dayRateStr;
	}

	public void setDayRateStr(String dayRateStr) {
		this.dayRateStr = dayRateStr;
	}

	@Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("areaId", getAreaId())
            .append("calculateTime", getCalculateTime())
            .append("yearBenefit", getYearBenefit())
            .append("status", getStatus())
            .append("dayRate", getDayRate())
            .append("createTime", getCreateTime())
            .append("createBy", getCreateBy())
            .append("remark", getRemark())
            .toString();
    }
    
    public static void main(String[] args) {
        //BigDecimal value = new BigDecimal("123.456789012345");
    	BigDecimal value = new BigDecimal("0.0000003650");
//    	System.out.println("value:"+value);
//        BigDecimal roundedValue = value.setScale(11, RoundingMode.HALF_UP);
//        System.out.println(roundedValue);
        DecimalFormat df = new DecimalFormat("#.###########");
        System.out.println(df.format(value.doubleValue()));
	}
    
}
